<?php
	if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');
	
	if ( post_password_required() ) { ?>
		<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.', 'yunjietheme'); ?></p> 
	<?php
		return;
	}
?>

<!-- You can start editing here. -->
<div class="commentsection">
	<div id="commentsmeta">
		<div id="commentscount"><?php comments_number(__('No Responses', 'yunjietheme'), __('One Response', 'yunjietheme'), __('% Responses', 'yunjietheme'));?>
		</div>
		<div id="commentandpingslink">
			<?php if ( comments_open() && pings_open() ) { ?>
				您可以<a href="#respond">发表高见</a>，或者<a href="<?php trackback_url(false); ?>" rel="trackback">Trackback此文</a>
			<?php } elseif ( !comments_open() && pings_open() ) {?>
				评论功能已关闭 | <a href="<?php trackback_url(false); ?>" rel="trackback">Trackback此文</a>
			<?php } elseif ( comments_open() && !pings_open() ) {?>
				<a href="#respond">发表您的高见</a> | Pings已关闭
			<?php } elseif ( !comments_open() && !pings_open() ) {?>
				评论功能已关闭 | Pings已关闭
			<?php } ?>
		</div>
		<div class="fixed"></div>
	</div>

<?php if ( have_comments() ) : ?>
	<?php
		$comment_pages = paginate_comments_links('echo=0');
		if ($comment_pages) {
	?>
			<div id="commentnavi">
				<?php echo $comment_pages; ?>
				<div class="fixed"></div>
			</div>
	<?php } ?>

	<ol class="commentlist">
	<?php wp_list_comments('callback=yunjie_list_comments');?>
	</ol>

<!--	<div class="navigation">
		<div class="alignleft"><?php previous_comments_link() ?></div>
		<div class="alignright"><?php next_comments_link() ?></div>
	</div>-->
  <?php else : // this is displayed if there are no comments so far ?>

	<?php if ( comments_open() ) : ?>
		<!-- If comments are open, but there are no comments. -->

	 <?php else : ?>
		<!-- If comments are closed. -->
	<?php endif; ?>
<?php endif; ?>
</div><!--commentlist end-->

<?php if ( comments_open() ) : ?>

<div id="respond">
<h3><span><?php comment_form_title( __('Leave a Reply', 'yunjietheme'), __('Leave a Reply for %s' , 'yunjietheme') ); ?>&nbsp;&nbsp;</span><small>[ <span title="当你的评论被回复, 是否接收邮件提醒" class="mailnotify" id="mailnotifysetup">邮件提醒: 开启</span> ]</small></h3>

<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'yunjietheme'), wp_login_url( get_permalink() )); ?></p>
<?php else : ?>

<form id="commentform">
<input type='hidden' name='cmt_mail_notify' id='cmt_mail_notify' value='1' />
<!--<div id="divrespondauthorinfo">-->
<?php if ( is_user_logged_in() ) : ?>

<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.', 'yunjietheme'), get_option('siteurl') . '/wp-admin/profile.php', $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account', 'yunjietheme'); ?>"><?php _e('Log out &raquo;', 'yunjietheme'); ?></a></p>

<?php else : ?>
<style type="text/css">
.cmtinforight{color:green;}
.cmtinfowrong{color:red;}
.respondfocus{border:1px solid yellow;}
#authorerr, #emailerr, #urlerr{padding:0 1em; font-weight:bold;}
</style>
<p id="authorinput"><input type="text" class="respauthor" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
<label for="author"><?php _e('Name', 'yunjietheme'); ?> <?php if ($req) _e("(required)", "yunjietheme"); ?></label><span id="authorerr"></span></p>

<p id="emailinput"><input type="text" class="respemail" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
<label for="email"><?php _e('Mail (will not be published)', 'yunjietheme'); ?> <?php if ($req) _e("(required)", "yunjietheme"); ?></label><span id="emailerr"></span></p>

<p id="urlinput"><input type="text" class="respurl" name="url" id="url" value="<?php echo  esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><?php _e('Website', 'yunjietheme'); ?></label><span id="urlerr"></span></p>

<?php endif; ?>
<!--</div>--><!-- end of <div id="divrespondauthorinfo"> -->
<!--<div id="divrespondsettings"><div id="divmailnotify"><input name="mailnotify" type="checkbox" id="mailnotify" />当有回复时接收邮件提醒</div></div>
<div class="fixed"></div>-->
<!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>', 'yunjietheme'), allowed_tags()); ?></small></p>-->

<p><textarea name="comment" class="respcomment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>

<div id="divcommentcommands">
<div id="divcommentsummit"><input class="commentsummit" name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit Comment', 'yunjietheme'); ?>" /></div>
<div id="cancel-comment-reply"><?php cancel_comment_reply_link() ?></div>
<div class="fixed"></div>
<?php comment_id_fields(); ?>
<!--<input type='hidden' name='comment_post_ID' value='<?php echo $post->ID; ?>' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />-->
</div>
<?php //do_action('comment_form', $post->ID); ?>

</form>

<?php endif; // If registration required and not logged in ?>
</div>

<?php endif; // if you delete this the sky will fall on your head ?>
